/**
* AutoSWF - Cody Cushing. March 26, 2009
* Copyright (c) 2009 Cody Cushing
* No use restrictions. Maintain this notice in all versions. 
**/

package com.autoswf.locator
{
	/**
	 * An object used by links to get a service synchronously or asynchronously from a locator.
	 */
	public class ServiceRequest
	{
		protected var _service:Class;
		protected var _handler:Function;
		protected var _result:Object;
		
		public function ServiceRequest(service:Class, handler:Function = null)
		{
			_service = service;
			_handler = handler;
		}
		
		
		/**
		 * The class definition of the service being requested.
		 */
		public function get service():Class
		{
			return _service;
		}
		
		
		/**
		 * The handler to invoke on service acquisition.
		 */
		public function get handler():Function
		{
			return _handler;
		}
		
		
		/**
		 * The result of the service request.
		 */		
		public function get result():Object
		{
			return _result;
		}
		
		
		/**
		 * Used to set the requested service reference.
		 */		
		internal function setResult(value:Object):void
		{
			_result = value;
		}
		
	}
}